package 图书馆管理系统.service.impl;

import 图书馆管理系统.book.Book;
import 图书馆管理系统.book.BookList;
import 图书馆管理系统.service.Service;

public class UpdateService implements Service {
    @Override
    public void work(BookList booklist) {
        System.out.println("请输入要修改的书籍名");
        String name = scanner.next();

        for (int i = 0; i < booklist.bookLists.size(); i++) {
            Book book = booklist.bookLists.get(i);
            if (book.getName().equals(name)){
                System.out.println("输入修改后的类型：");
                String type = scanner.next();
                System.out.println("输入修改后的价格");
                Double price = scanner.nextDouble();
                book.setState(false);
                book.setPrice(price);
                book.setType(type);
                return;
            }
        }
    }
}
